package cn.lfy.studentmanager.dao;

import java.util.List;

import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Options;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

import cn.lfy.studentmanager.domain.Academy;
import cn.lfy.studentmanager.domain.Student;


public interface AcademyDao {
	//实现新增
	@Insert("INSERT INTO academy(name) VALUES(#{name})")
	@Options(useGeneratedKeys=true, keyProperty="id", keyColumn="id")
	boolean add(Academy academy);
	
	//实现查询
	@Select("SELECT * FROM academy limit #{start},#{limit}")
	List<Academy> select(int start, int limit);
	
	//进行删除操作
	@Delete("DELETE FROM academy WHERE id =#{id}")
	boolean delete(int id);
	
	//完成修改数据
	@Update("UPDATE academy SET name=#{name} WHERE id=#{id}")
	boolean update(int id,String name);
	
	//完成分页，本质还是查询
	@Select("SELECT COUNT(*) FROM academy")
	int getCount();
	
	//查询院表中所有name
	@Select("SELECT * FROM academy")
	List<Academy> selectAll();
}
